/*
 * @Author: wangtao
 * @Date: 2020-08-20 14:07:42
 * @LastEditors: 汪滔
 * @LastEditTime: 2021-07-30 10:21:55
 * @Description:
 */

import React from 'react';
import {
  View,
  StyleSheet,
  Image,
  Text,
} from 'react-native';
import {
  empty10,
} from '@/images';
import { Button, msg } from '@/common';
import {
  px2dp,
  fontColorSecDeepGray,
} from '@/styles';

const { Submit } = Button;

export default class DriverUnCer extends React.Component {
  render() {
    return (
      <View style={styles.unCerContainer}>
        <Image source={empty10} resizeMode='stretch' style={styles.unCerImg} />
        <View style={styles.desc}>
          <Text style={styles.descText}>
            您不是缘多物流联盟司机，无法接单
          </Text>
          <Text style={styles.descText}>请前往认证!</Text>
        </View>

        <Submit
          text='申请认证'
          onClick={() => {
            this.goTo();
          }}
          boxStyle={{
            width: px2dp(590),
            height: px2dp(88),
            borderRadius: px2dp(44),
          }}
          btnTextStyle={{
            fontSize: px2dp(32),
          }}
        />
      </View>
    );
  }

  // 去哪里
  goTo = () => {
    const { driverCerStatus, driverCerData } = this.props;
    if (driverCerStatus === 0) {
      msg.emit('router: goToNext', { routeName: 'DriverCer', routerFrom: 'DriverMain', });
    } else if (driverCerStatus === 1) {
      msg.emit('router: goToNext', {
        routeName: 'FeedBackDriverCer',
        status: 1,
        title: '司机认证已提交审核中',
        desc: '工作人员将在3个工作日内给予答复',
        routerFrom: 'DriverMain',
      });
    } else if (driverCerStatus === 3) {
      msg.emit('router: goToNext', {
        routeName: 'FeedBackDriverCer',
        status: 0,
        title: '非常抱歉，您未能通过认证',
        desc: `原因：${driverCerData.descrption}`,
        routerFrom: 'DriverMain',
        routerTo: 'DriverCer',
      });
    }
  };
}

const styles = StyleSheet.create({
  unCerContainer: {
    flex: 1,
    alignItems: 'center',
    paddingHorizontal: px2dp(80),
    paddingTop: px2dp(140),
  },
  unCerImg: {
    width: px2dp(240),
    height: px2dp(240),
  },
  desc: {
    marginTop: px2dp(48),
    marginBottom: px2dp(56),
  },
  descText: {
    fontSize: px2dp(28),
    lineHeight: px2dp(36),
    color: fontColorSecDeepGray,
    textAlign: 'center',
  },
});
